package com.loan.job.service;

import com.loan.system.service.*;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 报表统计
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DataJobService {

    private final IncomeExpendDetailService incomeExpendDetailService;

    private final ExamineDataService examineDataService;

    private final ExamineOverDataService examineOverDataService;

    private final OverOneDataService overOneDataService;

    private final OverTwoDataService overTwoDataService;

    private final OverLastDataService overLastDataService;

    private final ApplyService applyService;

    /**
     * 收支统计
     * @throws Exception
     */
    @XxlJob("incomeExpendDetailData")
    public void incomeExpendDetailData() throws Exception {
        XxlJobHelper.log("run incomeExpendDetailData.");
        incomeExpendDetailService.incomeExpendDetailData();
    }

    /**
     * 审核信息分配数定时任务
     * @throws Exception
     */
    @XxlJob("examineDataJob")
    public void examineDataJob() throws Exception {
        XxlJobHelper.log("run examineDataJob.");
        examineDataService.addOrUpdateExamineData();
    }

    /**
     * 审核逾期报表定时任务
     * @throws Exception
     */
    @XxlJob("examineOverDataJob")
    public void examineOverDataJob() throws Exception {
        XxlJobHelper.log("run examineOverDataJob.");
        examineOverDataService.addOrUpdateExamineOverData();
    }


    /**
     * s0数据统计
     * @throws Exception
     */
    @XxlJob("oneOverData")
    public void oneOverDataJob() throws Exception {
        XxlJobHelper.log("run oneOverDataJob.");
        overOneDataService.addOneOverData();
    }

    /**
     * s1数据统计
     * @throws Exception
     */
    @XxlJob("twoOverData")
    public void twoOverDataJob() throws Exception {
        XxlJobHelper.log("run twoOverDataJob.");
        overTwoDataService.addTwoOverData();
    }

    /**
     * s2,s3数据统计
     * @throws Exception
     */
    @XxlJob("lastOverDataJob")
    public void lastOverDataJob() throws Exception {
        XxlJobHelper.log("run lastOverDataJob.");
        overLastDataService.addLastOverData();
    }

    /**
     * 商户未分配数据统计
     * @throws Exception
     */
    @XxlJob("companyUnassignedData")
    public void companyUnassignedData() throws Exception {
        XxlJobHelper.log("run companyUnassignedData.");
        applyService.companyUnassignedData();
    }

    /**
     * 提现监督报表
     * @throws Exception
     */
    @XxlJob("withdrawalSuperviseData")
    public void withdrawalSuperviseData() throws Exception {
        XxlJobHelper.log("run withdrawalSuperviseData.");
        applyService.withdrawalSuperviseData();
    }
}
